<?php

/**
 * This is the model class for table "anggotapgwkoperasi".
 *
 * The followings are the available columns in table 'anggotapgwkoperasi':
 * @property integer $apk_id
 * @property integer $apk_kec
 * @property integer $apk_kudjml
 * @property integer $apk_kudanggota
 * @property integer $apk_kudkaryawan
 * @property integer $apk_nonkudjml
 * @property integer $apk_nonkudanggt
 * @property integer $apk_nonkudkary
 * @property integer $apk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $apkKec
 */
class Anggotapgwkoperasi extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Anggotapgwkoperasi the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'anggotapgwkoperasi';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('apk_kec, apk_kudjml, apk_kudanggota, apk_kudkaryawan, apk_nonkudjml, apk_nonkudanggt, apk_nonkudkary, apk_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('apk_id, apk_kec, apk_kudjml, apk_kudanggota, apk_kudkaryawan, apk_nonkudjml, apk_nonkudanggt, apk_nonkudkary, apk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'apkKec' => array(self::BELONGS_TO, 'Kecamatan', 'apk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'apk_id' => 'Apk',
			'apk_kec' => 'Apk Kec',
			'apk_kudjml' => 'Apk Kudjml',
			'apk_kudanggota' => 'Apk Kudanggota',
			'apk_kudkaryawan' => 'Apk Kudkaryawan',
			'apk_nonkudjml' => 'Apk Nonkudjml',
			'apk_nonkudanggt' => 'Apk Nonkudanggt',
			'apk_nonkudkary' => 'Apk Nonkudkary',
			'apk_tahun' => 'Apk Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('apk_id',$this->apk_id);
		$criteria->compare('apk_kec',$this->apk_kec);
		$criteria->compare('apk_kudjml',$this->apk_kudjml);
		$criteria->compare('apk_kudanggota',$this->apk_kudanggota);
		$criteria->compare('apk_kudkaryawan',$this->apk_kudkaryawan);
		$criteria->compare('apk_nonkudjml',$this->apk_nonkudjml);
		$criteria->compare('apk_nonkudanggt',$this->apk_nonkudanggt);
		$criteria->compare('apk_nonkudkary',$this->apk_nonkudkary);
		$criteria->compare('apk_tahun',$this->apk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}